package com.findMoneyGame.interfaceComponents {
	
	import flash.ui.Mouse;
	import flash.ui.MouseCursor;
	import flash.events.MouseEvent;
	import flash.events.Event;
	import flash.display.MovieClip;
	
	public class MyButton extends MovieClip {

		private var _active : Boolean;

		public function get active () { return _active; }

		protected function get activeFrame () { return 'active'; }
		protected function get deactiveFrame () { return 'deactive'; }
		
		public function MyButton() {
			gotoDeactive();
			addEventListener(MouseEvent.MOUSE_OVER, function (e : MouseEvent) { gotoActive(); });
			addEventListener(MouseEvent.MOUSE_OUT, function (e : MouseEvent) { gotoDeactive(); });
		}

		protected function gotoActive () {
			if (Mouse.supportsCursor) {
				Mouse.cursor = MouseCursor.BUTTON;
			}
			_active = true;
			gotoAndStop(activeFrame);
		}
		protected function gotoDeactive () {
			if (Mouse.supportsCursor) {
				Mouse.cursor = MouseCursor.AUTO;
			}
			_active = false;
			gotoAndStop(deactiveFrame);
		}
	}
	
}
